import React, {Component} from 'react';
import withUser from "../hoc/user";

class User extends Component {
    state = {userList:[],isLoading:false}
    async getUsers(){
        this.setState({isLoading:true})
        const userList = await this.$http.get('/items')
        this.setState({userList,isLoading:false})
    }
    render() {
        return (
            <div>
                {
                    this.state.userList.map(user=>(
                        <div key={user.id}>
                            <a href={user.html_url}>{user.name}</a>
                        </div>
                    ))
                }
            </div>
        );
    }
    componentDidMount() {
        this.getUsers()
    }
}

export default withUser()(User);